package com.tan.common.tools;

import com.tan.common.mapstruct.BaseConvert;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author Tan-Bowen
 * @description
 * @date 2025/2/17 11:41
 */
public class ConvertTool {


    public static <T, S, C extends BaseConvert<T, S>> T toTarget(Class<C> cls, S s) {
        final C convert = Mappers.getMapper(cls);
        return convert.toTarget(s);
    }

    public static <T, S, C extends BaseConvert<T, S>> List<T> toTarget(Class<C> cls, List<S> s) {
        final C convert = Mappers.getMapper(cls);
        return convert.toTargets(s);
    }

}
